﻿using StackExchange.Redis;
using SvGame.Objects;

namespace SvGame.Logic;

public static partial class GameLogic
{
    public static bool GetRole(this Room room, long uid, out IRole role)
    {
        if (room.DictPlayer.TryGetValue(uid, out var p))
        {
            role = p;
            return true;
        }
        if (room.DictNpc.TryGetValue(uid, out var npc))
        {
            role = npc;
            return true;
        }
        role = null;
        return false;
    }
    public static bool HasRole(this Room room, long uid)
    {
        return room.DictPlayer.ContainsKey(uid) || room.DictNpc.ContainsKey(uid);
    }
}
